package baseFx.tests.database.monitor;

import baseFx.common.Assert;
import baseFx.database.execute.DbExecute;
import baseFx.database.monitor.Before;
import baseFx.database.monitor.DbWatcher;
import baseFx.database.monitor.WatchOperation;
import baseFx.database.where.ExecuteWhere;

@DbWatcher
class MemberWatcher {
    private DbExecute execute;

    public MemberWatcher(DbExecute execute) {
        this.execute = execute;
    }

    @Before(value = WatchOperation.update, table = Member.class)
    public void beforeUpdate(Member set, ExecuteWhere<Member> where) {
        Assert.isEquals(set.name, "aaa");
        Assert.isEquals(where.eq().id, 111);
    }

    @Before(value = WatchOperation.update, table = Member.class)
    public void afterUpdate(Member set, ExecuteWhere<Member> where) {
        Assert.isEquals(set.name, "aaa");
        Assert.isEquals(where.eq().id, 111);
    }
}
